package com.haoxi.gateway.cngpmsg;

public class CNGPSubmitRespMessage extends CNGPMessage {

    public CNGPSubmitRespMessage(byte buf[]) throws IllegalArgumentException {
        super.buf = new byte[31];
        if (buf.length != 31) {
            throw new IllegalArgumentException(
                    "The message that is sent by SMC is wrong");
        } else {
            System.arraycopy(buf, 0, super.buf, 0, 31);
        }
    }

    public byte[] getMsgId() {
        byte tmpMsgId[] = new byte[10];
        System.arraycopy(buf, 16, tmpMsgId, 0, 10);
        return tmpMsgId;
    }

    public int getCongestionState() {
        return buf[30];
    }

    public String toString() {
        StringBuffer strBuf = new StringBuffer();
        strBuf.append("CNGPSubmitRespMessage: ");
        strBuf.append("PacketLength=").append(getMsgLength());
        strBuf.append(",RequestID=").append(getRequestId());
        strBuf.append(",Status=").append(getStatus());
        strBuf.append(",SequenceId=").append(getSequenceId());
        strBuf.append(",MsgId=").append(getMsgId());
        strBuf.append(",CongestionState=").append(getCongestionState());
        return strBuf.toString();
    }
}
